using System;
using System.Data.Entity.ModelConfiguration;
using System.Data.Common;
using System.Data.Entity;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using HISModels.Entities;

namespace HISModels.Mapping
{
	public class RadiologyMap : EntityTypeConfiguration<Radiology>
	{
		public RadiologyMap()
		{
			// Primary Key
			this.HasKey(t => t.Id);

			// Properties
			// Table & Column Mappings
			this.ToTable("Radiologies");
			this.Property(t => t.Id).HasColumnName("Id");
			this.Property(t => t.MedicationPlanId).HasColumnName("MedicationPlanId");
			this.Property(t => t.RadiologyRecords).HasColumnName("RadiologyRecords");

			// Relationships
			this.HasOptional(t => t.MedicationPlan)
				.WithMany(t => t.Radiologies)
				.HasForeignKey(d => d.MedicationPlanId);
				
		}
	}
}

